﻿using ITXHWEB.Models;
using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Web.Mvc;
using WPFExcelReport;
using WPFExcelReport.Helpers;
using ITXHWEB.Infrastructure;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace ITXHWEB.Controllers
{
    public partial class WBBSTController
    {
        [ChildActionOnly]
        public ActionResult SGEBNR(string returnUrl)
        {
            ModelState.Clear();
            ViewBag.ReturnUrl = returnUrl;
            if (!MABF.CWBB.IsGEBNRReady)
            {
                INFO = "请扫描有效的布车，若不扫描布车，请直接确定";
            }
            MABF.CWBB.REMARK = INFO;
           return PartialView(MABF.CWBB);
        }
        [HttpPost]
        [AllowAnonymous]
        [ValidateAntiForgeryToken]
        public ActionResult SGEBNR(WBBSTModel model, string returnUrl)
        {
            try
            {
                if (model.GEBNR == null)
                    model.GEBNR = "";
                ModelState.Clear();
                MABF.CWBB.GEBNR =Helper.Left(model.GEBNR.Trim().PadRight(8),8);
                MABF.CWBB.IsGEBNRReady = true;
                MABF.IsPDCReady = true;
                INFO = "开始扫描布卷";
            }
            catch (Exception ex)
            {
                INFO = ex.Message;
                Tracer.Error(ex.StackTrace, ex);
            }
            return RedirectToAction(MAPP, MAPP);
        }
    }
}
